<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="../../static/BOSGeo/BOSGeo.css" />
  <title>添加标记</title>
  <style>
    html {
      font-size: 12px;
    }

    html,
    body,
    #mapContainer {
      height: 100%;
      width: 100%;
      padding: 0;
      margin: 0;
    }

  </style>
</head>

<body>
  <div id="mapContainer"></div>
  <script src="../../static/BOSGeo/BOSGeo.js"></script>
  <script>
    var map = new BOSGeo.Map('mapContainer', {
    mapType: BOSGeo.TDT_IMAGERY
    });

    var layers = map.layers;
    var markCollection = new BOSGeo.LayerCollection({
        name: '标记集合',
        type: 'mark'
    });
    layers.add(markCollection);

    var mark = new BOSGeo.MarkLayer({
    name: '标记',
    position: [121.4620, 31.16714, 19.75],
    // onClick: layer => {
    //     layer.zoomTo();
    // },
    show: true,
    point: { // 点的样式
        size: 10,
        color: '#ff0',
        outlineColor: '#0f0',
        outlineWidth: 4,
        attribute: {
            a: 'adaf',
            b: 3
        }
    },
    text: { // 添加文字
        content: 'test',
        // backgroundColor: '#000',
        offset: [0, -10],
    },
    icon: { // 添加图片
        url: '../../static/html/images/start.png',
        offset: [0, -20],
    }
    });
    markCollection.add(mark);
    // layers.remove(markCollection); // 移除marker
    
    map.viewFix(121.4658, 31.16493, 1000, {
    heading: 283.40944,
    pitch: -84.58174,
    roll: 178.23488
    })
  </script>
</body>

</html>